home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / nShell Prog / hello.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-04  |  1.1 KB  |  54 lines  |  [TEXT/KAHL]

  1. /* ========== the commmand file: ==========
  2.  
  3.     hello.c - an examle of a simple nShell(tm) command.
  4.     
  5.     Copyright (c) 1993,1994 Newport Software Development
  6.     
  7.     You may distribute unmodified copies of this file for
  8.     noncommercial purposes.  You may use this file as a
  9.     reference when writing your own nShell(tm) commands.
  10.     
  11.     All other rights are reserved.
  12.     
  13.    ========== the commmand file: ========== */
  14.  
  15. #ifdef __MWERKS__            // CodeWarrior requires an A4 setup
  16. #include <A4Stuff.h>
  17. #endif
  18.  
  19. #include "nshc.h"
  20.  
  21. #include "nshc_utl.proto.h"
  22.  
  23. void main(t_nshc_parms *nshc_parms, t_nshc_calls *nshc_calls)
  24. {
  25. #ifdef __MWERKS__
  26.     long oldA4  = SetCurrentA4();
  27. #endif
  28.     
  29.     if (!nshc_bad_version( nshc_parms, nshc_calls, NSHC_VERSION )) {
  30.     
  31.         // otherwise, handle requests from the application
  32.     
  33.           switch (nshc_parms->action) {
  34.             case nsh_start:
  35.                 nshc_calls->NSH_printf("Hello World\r");
  36.                 break;
  37.             case nsh_continue:
  38.             case nsh_idle:
  39.             case nsh_stop:
  40.                 break;
  41.             }
  42.         
  43.         // tell the application we are done
  44.  
  45.          nshc_parms->action = nsh_idle;
  46.         nshc_parms->result = NSHC_NO_ERR;
  47.  
  48.         }
  49.         
  50. #ifdef __MWERKS__
  51.     SetA4(oldA4);        // CodeWarrior needs to restore A4
  52. #endif
  53. }
  54.